﻿CREATE PROCEDURE [dbo].[automovel_SelectVitrine]
	
AS
	SELECT 
		TBAutomovel.automovelID,
		TBAutomovel.Descricao,
		TBAutomovel.ativo,
		TBAutomovel.modeloID,
		TBAutomovel.garagemID,
		TBAutomovel.anoFabricacao,
		TBAutomovel.anoModelo,
		TBAutomovel.preco,
		TBAutomovel.blindado,
		TBAutomovel.quilometragem,
		TBAutomovel.cambio,
		TBAutomovel.portas,
		TBAutomovel.cor,
		TBAutomovel.combustivel,
		TBAutomovel.observacoes,
		TBAutomovel.pasta,
		TBModelo.descricao as descricaoModelo,
		TBGaragem.Nome as descricaoGaragem,
		TBMarca.descricao as descricaoMarca,
		TBMarca.marcaID as marcaID,
		TBAutomovel.Venda as Venda,
		TBAutomovel.vitrine as Vitrine
FROM
		TBAutomovel
INNER JOIN
		TBModelo ON(TBAutomovel.modeloID = TBModelo.modeloID)
INNER JOIN
		TBMarca ON(TBModelo.marcaID = TBMarca.marcaID)
INNER JOIN
		TBGaragem ON(TBAutomovel.garagemID = TBGaragem.garagemID)
WHERE 
		TBAutomovel.vitrine = 1
			
ORDER BY TBAutomovel.automovelID DESC
